<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<?php
$servername = "mysql";
$username = "root";
$password = "password";
$dbname = "test";

// 创建连接
$conn = new mysqli($servername, $username, $password, $dbname);
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}

$sql = "SELECT name, boy FROM text1";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // 输出每行数据
    while($row = $result->fetch_assoc()) {
        $name = $row["name"];
        $boy = $row["boy"];
        echo "<br> 账号:<a href='/task/plan_form.php?name=$name'>$name</a> - 密码: $boy";
    }
} else {
    echo "0 个结果";
}
$conn->close();
?>
<ul>
    <li><a href="/crud/form_user.php">添加.html</a></li>
    <li><a href="/crud/chaxun.php">列表</a></li>
</ul>
</body>
</html>
